home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 317 / asmsrc / expr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  2.6 KB  |  72 lines

  1. /* expr.h -> header file for expr.c */
  2.  
  3. /* Copyright (C) 1987 Free Software Foundation, Inc.
  4.  
  5. This file is part of Gas, the GNU Assembler.
  6.  
  7. The GNU assembler is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY.  No author or distributor
  9. accepts responsibility to anyone for the consequences of using it
  10. or for whether it serves any particular purpose or works at all,
  11. unless he says so in writing.  Refer to the GNU Assembler General
  12. Public License for full details.
  13.  
  14. Everyone is granted permission to copy, modify and redistribute
  15. the GNU Assembler, but only under the conditions described in the
  16. GNU Assembler General Public License.  A copy of this license is
  17. supposed to have been given to you along with the GNU Assembler
  18. so you can know your rights and responsibilities.  It should be
  19. in a file named COPYING.  Among other things, the copyright
  20. notice and this notice must be preserved on all copies.  */
  21.  
  22. /*
  23.  * Abbreviations (mnemonics).
  24.  *
  25.  *    O    operator
  26.  *    Q    quantity,  operand
  27.  *    X    eXpression
  28.  */
  29.  
  30. /*
  31.  * By popular demand, we define a struct to represent an expression.
  32.  * This will no doubt mutate as expressions become baroque.
  33.  *
  34.  * Currently, we support expressions like "foo-bar+42".
  35.  * In other words we permit a (possibly undefined) minuend, a
  36.  * (possibly undefined) subtrahend and an (absolute) augend.
  37.  * RMS says this is so we can have 1-pass assembly for any compiler
  38.  * emmissions, and a 'case' statement might emit 'undefined1 - undefined2'.
  39.  *
  40.  * To simplify table-driven dispatch, we also have a "segment" for the
  41.  * entire expression. That way we don't require complex reasoning about
  42.  * whether particular components are defined; and we can change component
  43.  * semantics without re-working all the dispatch tables in the assembler.
  44.  * In other words the "type" of an expression is its segment.
  45.  */
  46.  
  47. typedef struct
  48. {
  49.     symbolS *X_add_symbol;        /* foo */
  50.     symbolS *X_subtract_symbol;    /* bar */
  51.     long int X_add_number;        /* 42.    Must be signed. */
  52.     segT    X_seg;            /* What segment (expr type)? */
  53. }
  54. expressionS;
  55.  
  56.                 /* result should be type (expressionS *). */
  57. #define expression(result) expr(0,result)
  58.  
  59.                 /* If an expression is SEG_BIG, look here */
  60.                 /* for its value. These common data may */
  61.                 /* be clobbered whenever expr() is called. */
  62. extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
  63.                 /* Enough to hold most precise flonum. */
  64. extern LITTLENUM_TYPE generic_bignum []; /* Bignums returned here. */
  65. #define SIZE_OF_LARGE_NUMBER (20)    /* Number of littlenums in above. */
  66.  
  67.  
  68. segT        expr();
  69. char        get_symbol_end();
  70.  
  71. /* end: expr.h */
  72.